<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
    <title>Meeting会议管理系统</title>
    <link href="/styles/common.css" rel="stylesheet"/>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.js"></script>
    <script src="/My97DatePicker/WdatePicker.js"></script>

</head>
<body>
<%@ include file="top.jsp" %>
<div class="page-body">
    <%@ include file="leftMenu.jsp" %>
    <div class="page-content">
        <div class="content-nav">
            会议预定 > 搜索会议
        </div>
        <form action="/searchmeeting" method="post">
            <fieldset>
                <legend>搜索会议</legend>
                <table class="formtable">
                    <tr>
                        <td>会议名称：</td>
                        <td>
                            <input type="text" name="meetingname" id="meetingname"
                                   value="${searchMeeting.meeting.meetingname}" maxlength="20"/>
                        </td>
                        <td>会议室名称：</td>
                        <td>
                            <input type="text" name="roomname" id="roomname"
                                   value="${searchMeeting.meeting.meetingRoom.roomName}" maxlength="20"/>
                        </td>
                        <td>预定者姓名：</td>
                        <td>
                            <input type="text" name="reservationistname" id="reservationistname"
                                   value="${searchMeeting.name}" maxlength="20"/>
                        </td>
                    </tr>
                    <tr>
                        <td>预定日期：</td>
                        <td colspan="6">
                            在&nbsp;<input class="Wdate" type="text" name="reservationtime" id="reservationtime"
                                          value="${searchMeeting.meeting.reservationtime}"
                                          onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})"/>以后
                        </td>
                    </tr>
                    <tr>
                        <td>会议日期：</td>
                        <td colspan="6">
                            从&nbsp; <input class="Wdate" type="text" id="starttime" name="starttime"
                                           value="${searchMeeting.meeting.starttime}"
                                           onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})"/>
                            &nbsp;<input class="Wdate" type="text" id="endtime" name="endtime"
                                          value="${searchMeeting.meeting.endtime}"
                                          onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})"/>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="6" class="command">
                            <input type="submit" class="clickbutton" value="查询"/>
                            <input type="reset" class="clickbutton" value="重置"/>
                        </td>
                    </tr>
                </table>
            </fieldset>
        </form>
        <div>
            <h3 style="text-align:center;color:#000000">查询结果</h3>
            <div class="pager-header">
                <div class="header-info">
                    共<span class="info-number">${total}</span>条结果，
                    分成<span class="info-number">${pagenum}</span>页显示，
                    当前第<span class="info-number">${page}</span>页
                </div>
                <div class="header-nav">
                    <a type="button" class="clickbutton" href="/searchmeeting?meetingname=${searchMeeting.meeting.meetingname}&roomname=${searchMeeting.meeting.meetingRoom.roomName}&reservationistname=${searchMeeting.name}&reservationtime=${searchMeeting.meeting.reservationtime}&starttime=${searchMeeting.meeting.starttime}&endtime=${searchMeeting.meeting.endtime}&page=1">首页</a>
                    <a type="button" class="clickbutton"
                    <%--                            <#if page!=1>--%>
                    <%--                                href="/searchmeetings?&page=${page-1}"--%>
                    <%--                            </#if>--%>
                            <c:if test="${page ne 1}">
                                href="/searchmeeting?meetingname=${searchMeeting.meeting.meetingname}&roomname=${searchMeeting.meeting.meetingRoom.roomName}&reservationistname=${searchMeeting.name}&reservationtime=${searchMeeting.meeting.reservationtime}&starttime=${searchMeeting.meeting.starttime}&endtime=${searchMeeting.meeting.endtime}&page=${page-1}"
                            </c:if>
                    >上页</a>
                    <a type="button" class="clickbutton"
                    <%--                            <#if page!=pagenum>--%>
                    <%--                                href="/searchmeetings?&page=${page+1}"--%>
                    <%--                            </#if>--%>
                            <c:if test="${page ne pagenum}">
                                href="/searchmeeting?meetingname=${searchMeeting.meeting.meetingname}&roomname=${searchMeeting.meeting.meetingRoom.roomName}&reservationistname=${searchMeeting.name}&reservationtime=${searchMeeting.meeting.reservationtime}&starttime=${searchMeeting.meeting.starttime}&endtime=${searchMeeting.meeting.endtime}&page=${page+1}"
                            </c:if>
                    >下页</a>
                    <a type="button" class="clickbutton"
                       href="/searchmeeting?meetingname=${searchMeeting.meeting.meetingname}&roomname=${searchMeeting.meeting.meetingRoom.roomName}&reservationistname=${searchMeeting.name}&reservationtime=${searchMeeting.meeting.reservationtime}&starttime=${searchMeeting.meeting.starttime}&endtime=${searchMeeting.meeting.endtime}&page=${pagenum}">尾页</a>
                </div>
            </div>
        </div>
        <table class="listtable">
            <tr class="listheader">
                <th>会议名称</th>
                <th>会议室名称</th>
                <th>会议开始时间</th>
                <th>会议结束时间</th>
                <th>会议预定时间</th>
                <th>预定者</th>
            </tr>
            <c:forEach items="${searchMeetings}" var="searchMeeting">
                <tr>
                    <td>${searchMeeting.meeting.meetingname}</td>
                    <td>${searchMeeting.meeting.meetingRoom.roomName}</td>
                    <td><fmt:formatDate value="${searchMeeting.meeting.starttime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                    <td><fmt:formatDate value="${searchMeeting.meeting.endtime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                    <td><fmt:formatDate value="${searchMeeting.meeting.reservationtime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                    <td>${searchMeeting.name}</td>
                </tr>
            </c:forEach>
            <%--            <#if meetings??>--%>
            <%--                <#list meetings as m>--%>
            <%--                    <tr>--%>
            <%--                        <td>${m.meetingname}</td>--%>
            <%--                        <td>${m.roomname}</td>--%>
            <%--                        <td>${m.starttime?string('yyyy-MM-dd HH:mm:ss')}</td>--%>
            <%--                        <td>${m.endtime?string('yyyy-MM-dd HH:mm:ss')}</td>--%>
            <%--                        <td>${m.reservationtime?string('yyyy-MM-dd HH:mm:ss')}</td>--%>
            <%--                        <td>${m.reservationistname}</td>--%>
            <%--                        <td>--%>
            <%--                            <a class="clickbutton" href="/meetingdetails?meetingid=${m.meetingid}">查看详情</a>--%>
            <%--                        </td>--%>
            <%--                    </tr>--%>
            <%--                </#list>--%>
            <%--            </#if>--%>

        </table>
    </div>
</div>
<%@include file="down.jsp"%>
</body>
</html>